// pages/component/detailHeader/index.js
Component({
  /**
   * 组件的属性列表
   */
  options:{
    addGlobalClass:true
  },
  properties: {
      result:{
        type:Object
      }
  },

  /**
   * 组件的初始数据
   */
  data: {
      activeBtn:1003,
      date:""
  },

  /**
   * 组件的方法列表
   */
  methods: {
    btn(e){
      let index=e.currentTarget.dataset.index
      this.triggerEvent('sumit',{index,date:''})
      this.setData({
       activeBtn:index
     })
    
    },
    clearDate(){
      this.triggerEvent('sumit',{index:this.data.activeBtn,date:''})
    },
    pickerdate(e){
      let date = e.detail.value
      this.triggerEvent('sumit',{index:this.data.activeBtn,date})
      this.setData({
        date
      })
    },
    
  },
  lifetimes:{
    attached(){
      let date=new Date()
      let year=date.getFullYear()
      let month=date.getMonth()+1
      let day =date.getDate()
      let time = `${year}-${month<10?'0'+month:month}-${day<10?'0'+day:day}`
      this.setData({
        date:time
      })
    }
  }
})
